package com.zkingsoft.picbroswer.album.imageloader;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;

import java.io.File;

/**
 * Created by ytf on 2017/3/7 007.
 * Description: Glide图片加载
 */

public class UniversalAndroidImageLoader implements ImageLoaderWrapper
{
    @Override
    public void displayImage(Context context, ImageView imageView, File imageFile, DisplayOption option)
    {
        Glide.with(context)
                .load(imageFile)
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .error(option.loadErrorResId)
                .placeholder(option.loadingResId)
                .into(imageView);
    }

    @Override
    public void displayImage(Context context, ImageView imageView, String imageUrl, DisplayOption option)
    {
        Glide.with(context)
                .load(imageUrl)
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .error(option.loadErrorResId)
                .placeholder(option.loadingResId)
                .into(imageView);
    }
}
